package com.xz.xzliving.commodity.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.xz.xzliving.common.utils.PageUtils;
import com.xz.xzliving.common.utils.Query;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.xz.xzliving.commodity.dao.BrandDao;
import com.xz.xzliving.commodity.entity.BrandEntity;
import com.xz.xzliving.commodity.service.BrandService;


@Service("brandService")
public class BrandServiceImpl extends ServiceImpl<BrandDao, BrandEntity> implements BrandService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
//        LambdaQueryWrapper<BrandEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
//        System.out.println(params);
//        if (params != null && !StringUtils.isBlank(params.get("key") + "")){
//            lambdaQueryWrapper = new LambdaQueryWrapper<BrandEntity>().like(BrandEntity::getName, params.get("key"));
//        }
        IPage<BrandEntity> page = this.page(
                new Query<BrandEntity>().getPage(params),
                new QueryWrapper<>()
//                lambdaQueryWrapper
        );

        return new PageUtils(page);
    }

}